package org.bjf.modules.sys.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import lombok.extern.slf4j.Slf4j;
import org.bjf.modules.core.service.BaseService;
import org.bjf.modules.sys.bean.SysUserRole;
import org.bjf.modules.sys.mapper.SysUserRoleMapper;
import org.bjf.modules.sys.query.SysUserRoleQuery;
import org.springframework.stereotype.Service;

/**
 * @author bjf
 * @date 2017/11/27
 */
@Service
@Slf4j
public class SysUserRoleService extends
    BaseService<SysUserRoleMapper, SysUserRole, SysUserRoleQuery> {


  @Override
  protected EntityWrapper<SysUserRole> buildQuery(SysUserRoleQuery q) {
    if (q == null) {
      return null;
    }
    EntityWrapper<SysUserRole> ew = new EntityWrapper<>();
    ew.eq(q.getSysUserId() != null, "sys_user_id", q.getSysUserId());
    ew.eq(q.getSysRoleId() != null, "sys_role_id", q.getSysRoleId());
    return ew;
  }

}
